package com.shiguiwu.springmybatis.designpattern.builder;

import lombok.Getter;

/**
 * @description: 课程类
 * @author: stone
 * @date: Created by 2021/2/20 18:44
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.designpattern.builder
 */
@Getter
public class Course {

    private String title;

    private Long token;

    private String author;

    private Integer pageSize;



    public Course(CourseBuilder builder) {
        this.author = builder.author;
        this.title = builder.title;
        this.pageSize = builder.pageSize;
        this.token = builder.token;
    }

    public static class CourseBuilder {

        private String title;

        private Long token;

        private String author;

        private Integer pageSize;

        //标题
        public  CourseBuilder buildTitle(String title){
            this.title = title;
            return this;
        }


        //页数
        public  CourseBuilder buildPageSize(Integer pageSize){
            this.pageSize = pageSize;
            return this;
        }

        //作者
        public  CourseBuilder buildAuthor(String author){
            this.author = author;
            return this;
        }
        //时长
        public  CourseBuilder buildLong(Long token){
            this.token = token;
            return this;
        }

        public static CourseBuilder builder() {
            return new CourseBuilder();
        }

        public Course build() {
            return new Course(this);
        }

    }




}
